<?php

namespace  app\command\controller;

use common\model\sell66\BotInv;
use common\service\ChainService;
use think\Exception;

/**
 * 检查饰品银行钱包状态
 * 
 * @author zhouqiang
 * @date 2018-06-14
 */
class CheckOutAsset
{

	protected function getTakingInvsByAll()
	{
		return BotInv::getTakingInvsByAll();
	}

	protected function checkAssetAll()
	{
		$invs = $this->getTakingInvsByAll();
		if (!$invs) {
			echo 'query taking bot inv failed'."\r\n";
			return false;
		}

		foreach ($invs as $inv) {
			$res = ChainService::getInstance()->checkTakeBackStatus($inv['bot_inv_id']);
			if (!$res) {
				echo 'check take back failed, botinvid: '.$inv['bot_inv_id']."\r\n";
				continue;
			}
			echo 'check take back success, botinvid: '.$inv['bot_inv_id']."\r\n";
		}

		return true;
	}

	public function handle()
	{
		$this->checkAssetAll();
		echo '数据查询完毕！'."\r\n";
		return true;
	}
}